package com.cjm.one.common.constant;

import cn.hutool.jwt.signers.JWTSigner;
import cn.hutool.jwt.signers.JWTSignerUtil;

import java.nio.charset.StandardCharsets;
import java.security.Key;

public class TokenConstants {
    // 令牌前缀
    public static final String TOKEN_PREFIX = "Bearer ";
    // 令牌名称
    public static final String AUTHENTICATION = "Authorization";
    // 令牌密钥
    public final static String SECRET = "cc2u8k87s8fn8yjds8f7ds8f9";
    // token过期时间 单位：毫秒
    public final static int TOKEN_EXPIRATION_TIME = 60 * 60 * 1000 * 24*365;
    // 刷新token
    public final static int TOKEN_EXPIRATION_REFRESH_TIME = 30;

    // 用户id
    public final static String USER_ID = "userId";
    // 用户名
    public final static String USER_NAME = "userName";
    // 角色
    public final static String ROLE = "role";
    // 权限
    public final static String PERMISSION = "permission";
    public final static String SYS_USER = "sysUser";
    public final static String APP_USER = "appUser";

    public final static JWTSigner SIGNER = JWTSignerUtil.hs256(SECRET.getBytes(StandardCharsets.UTF_8));
}
